Visual Studio Code Shortcuts - WittyWriter

Visual Studio Code Shortcuts

📘 Key Concepts and Definitions

🧮 Shortcut Syntax Patterns

VS Code uses two main types of shortcuts:

When a shortcut is displayed as Ctrl+K S, it means press and hold Ctrl, press K, release both, and then press S.

🛠️ Key Command Palette Commands

Open the Command Palette with Ctrl+Shift+P or Cmd+Shift+P and type these commands:

🧭 Step-by-Step Workflows

Workflow: Renaming a Variable Across Multiple Files

  1. Click on the variable or function you want to rename.
  2. Press F2 (on all platforms).
  3. Type the new name and press Enter.
  4. VS Code will preview the changes across all files. Confirm to apply them.

Workflow: Quick File Navigation

  1. Press Ctrl+P (Windows/Linux) or Cmd+P (macOS) to open the file search.
  2. Start typing the name of the file you want to open.
  3. To go to a specific line, type : followed by the line number (e.g., index.html:52).
  4. To go to a symbol (function, class), type @ followed by the symbol name.

⌨️ Core Shortcuts and Productivity

This is the core list of shortcuts. For a comprehensive list, see the official documentation.

Tip: Multi-Cursor Editing
Use Ctrl+Alt+/ (Windows/Linux) or Cmd+Option+/ (macOS) to insert cursors on multiple lines. This is incredibly powerful for batch editing.

📊 Shortcut Reference Table

General & Essential

Action Windows/Linux macOS
Show Command Palette Ctrl+Shift+P Cmd+Shift+P
Quick Open (Go to File) Ctrl+P Cmd+P
Toggle Terminal Ctrl+` Ctrl+`
Toggle Side Bar Ctrl+B Cmd+B

Editing & Navigation

Action Windows/Linux macOS
Copy Line Up/Down Shift+Alt+/ Shift+Option+/
Move Line Up/Down Alt+/ Option+/
Toggle Line Comment Ctrl+/ Cmd+/
Select Next Match Ctrl+D Cmd+D
Go to Definition F12 F12
Split Editor Ctrl+\ Cmd+\

🧪 Examples and Use Cases

Use Case: Creating a Custom Shortcut

Let's say you want to create a shortcut to save all files without formatting them, which isn't bound by default.

  1. Open the Keyboard Shortcuts file with >Preferences: Open Keyboard Shortcuts (JSON).
  2. Add your custom binding to the JSON array.
[
    // ... your other custom shortcuts
    {
        "key": "ctrl+k ctrl+alt+s",
        "command": "workbench.action.files.saveAll",
        "when": "!notebookEditorFocused"
    }
]

Now, pressing Ctrl+K followed by Ctrl+Alt+S will save all files.

🧹 Troubleshooting

📚 References and Further Reading

🍪 We use cookies to improve your experience. Learn more